|
|||||||||||||||||||
This license of Clover is provided to support the development of Flock only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
MetaStartsWith.java | 0% | 0% | 0% | 0% |
|
1 |
package net.sf.flock.filter; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
import java.util.ListIterator; |
|
5 |
|
|
6 |
import net.sf.flock.FilterI; |
|
7 |
import net.sf.flock.ItemI; |
|
8 |
|
|
9 |
public class MetaStartsWith implements FilterI { |
|
10 |
|
|
11 |
private final String key; |
|
12 |
private final String value; |
|
13 |
|
|
14 | 0 |
public MetaStartsWith(String key, String value) { |
15 | 0 |
this.key = key; |
16 | 0 |
this.value = value; |
17 |
} |
|
18 |
|
|
19 | 0 |
public List filter(List items) { |
20 | 0 |
for (ListIterator i=items.listIterator(); i.hasNext(); ) { |
21 | 0 |
ItemI item = (ItemI)i.next(); |
22 |
|
|
23 | 0 |
String val = item.getOrigin().getSubscriptionInfo().getMetaData().get(this.key); |
24 |
|
|
25 | 0 |
if (val==null || !val.startsWith(this.value)) { |
26 | 0 |
i.remove(); |
27 |
} |
|
28 |
} |
|
29 | 0 |
return items; |
30 |
} |
|
31 |
|
|
32 |
} |
|
33 |
|
|